package com.kai.steering.data.service.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableName;
import com.kai.steering.data.service.entity.domainObject.ClassificationDO;
import com.kai.steering.data.service.entity.dto.ClassificationQueryDTO;
import lombok.*;

import java.io.Serializable;

/**
 * <pre>
 * 题目分类
 * </pre>
 *
 * @author kai
 * @since 2022-02-23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ToString
@EqualsAndHashCode(callSuper = false)
@TableName(value = "classification")

public class Classification implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 分类id
     */
    @TableId(value = "classification_id", type = IdType.ID_WORKER)

    private String classificationId;


    /**
     * 分类
     */

    private String classificationName;


    /**
     * 分类信息
     */

    private String content;


    /**
     * 管理员id或者用户id
     */

    private String founder;


    /**
     * 创建时间
     */

    private Date creationDatetime;


    /**
     * 存在0删除1
     */

    private Integer usable;


    /**
     * 删除日期
     */

    private Date deleteDatetime;


    public Classification(ClassificationQueryDTO classificationQueryDTO) {
        this.classificationId= classificationQueryDTO.getClassificationId();
        this.classificationName= classificationQueryDTO.getClassificationName();
        this.content= classificationQueryDTO.getContent();
        this.founder= classificationQueryDTO.getFounder();
        this.creationDatetime= null;

        this.deleteDatetime= null;

    }

    public Classification(ClassificationDO classificationDO) {
        this.classificationId= classificationDO.getClassificationId();
        this.classificationName= classificationDO.getClassificationName();
        this.content= classificationDO.getContent();
        this.founder= classificationDO.getFounder();
        this.creationDatetime= classificationDO.getCreationDatetime();
        this.usable= classificationDO.getUsable();
        this.deleteDatetime= getDeleteDatetime();
    }
}
